var left_panel, middle_panel, right_panel;
var i_list_grid, properties_grid;
var ci_list_panel;
var canvas;
var select_layer_panel;



var setBlankCIList = function(){
    var table_body_line =     Math.floor(($('#left_panel').height() - 350)/30);
    var html = '';
    for(var i = 1 ; i<= table_body_line; i++){
        html += '<tr class="'+ (i % 2 == 0 ? '':'k-alt')+'"><td width="100">&nbsp;</td><td width="100"></td><td  style="width:450px;" ></td><td style="width:150px;"></td><td width="100"></td><td width="100"></td><td width="100"></td><td width="100"></td><td width="100" ></td></tr>';
    };
    $("#ci_list_grid tbody").html(html);

}

var setRightBlankPanel = function(){
    var table_body_line =     Math.floor(($('#right_panel').height()  / 2)/30);
    var html = '';
    for(var i = 1 ; i<= table_body_line; i++){
        html += '<tr class="'+ (i % 2 == 0 ? '':'k-alt')+'"><td >&nbsp;</td><td ></td></tr>';
    };
    $("#properties_grid tbody").html(html);
    $("#attributes_grid tbody").html(html);
}

var CanvasPanelPosition = function(){
    $('#control_panel').css('top',$('#panel').height() - 50);
    $('#panel .k-window').css('z-index',2);
    $('#control_panel').width($('#panel').width());
    
    //$('#panel').width()
}

$(document).ready(function(){
    
    $('body').layout({split:true});
    
    $("#search_panel").kendoWindow({
         title:'Search for Cls',
         draggable: false,
         resizable: false,
         actions:false,
         appendTo:'#left_panel'
         });
         
    $("#properties_grid_panel").kendoWindow({
         title:'Properties',
         draggable: false,
         resizable: false,
         actions:false,
         appendTo:'#right_panel'
         });
         
    $("#attributes_grid_panel").kendoWindow({
         title:'Attributes',
         draggable: false,
         resizable: false,
         actions:false,
         appendTo:'#right_panel'
         });

    $("#canvas_panel").kendoWindow({
         title:'Canvas Panel',
         //width:$('#panel').width(),
         height:$('#panel').height() - 100 ,
         draggable: false,
         resizable: false,
         resize:function(){
             go_panel.rebuildParts()
         },
         actions:["Maximize"],
         appendTo:'#panel'
         });
         
    ci_list_panel = $("#ci_list_panel").kendoWindow({
         title:'CI List',          
         draggable: false,
         resizable: false,
         actions:false,
         appendTo:'#left_panel'
         }).data("kendoWindow");     
                                                   
                             
                             
    ci_list_grid = $("#ci_list_grid").kendoGrid({
         scrollable: true,
         selectable: true,
         height: Math.floor(($('#left_panel').height() - 410)),
    }).data("kendoGrid");
    
    properties_grid = $("#properties_grid").kendoGrid({
         scrollable: true,
         selectable: true
    }).data("kendoGrid");
    
    properties_grid = $("#attributes_grid").kendoGrid({
         scrollable: true,
         selectable: true
    }).data("kendoGrid");
    
    
    
    $('input[name="line"]').change(function(){
        layerChange();
    });
    
    
getCutonmer();
CanvasInit();

//设定空白表格
setBlankCIList()
setRightBlankPanel();
CanvasPanelPosition();

})